package exprarbre;

public class ASANonBitUnaire extends ASAExpr {

    private ASAExpr e1;

    public ASANonBitUnaire(ASAExpr e1) {
        this.e1 = e1;
    }

    @Override
    public ASAExpr getExpr1() {
        return e1;
    }

    @Override
    public int evalue() {
        return ~e1.evalue();
    }

    @Override
    public ASAExpr simplifie() {
        ASAExpr se1 = e1.simplifie();

        if (se1 instanceof ASAEntier) {
            return new ASAEntier(evalue());
        }

        return new ASANonBitUnaire(se1);
    }
}